package com.yoyosys.db.partition.vo;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
@ApiModel(value="Message",discriminator = "foo",subTypes = {Message.class})
public class Message {
	private static final long serialVersionUID = 1L;
	@ApiModelProperty(value = "错误码")
	private String code;
	@ApiModelProperty(value = "错误信息")
	private String msg;

	@ApiModelProperty(value = "请求时间戳")
	private String beginTime;
	@ApiModelProperty(value = "请求时间戳")
	private String endTime;
	@ApiModelProperty(value = "执行时长")
	private long costTime;

	@ApiModelProperty(value = "返回数据")
	private Object data;

	public Message(){
		this.beginTime = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT);
	}

	public void setCostTime(long costTime){
		this.costTime = costTime;
		this.endTime = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT);
	}

}
